package c.e.a.b.f.b;

import java.util.Objects;
import java.util.concurrent.BlockingQueue;

/* compiled from: com.google.android.gms:play-services-measurement-impl@@18.0.0 */
public final class v4 extends Thread {
    public final Object a;
    public final BlockingQueue<s4<?>> b;
    public boolean c = false;
    public final /* synthetic */ r4 d;

    public v4(r4 r4Var, String str, BlockingQueue<s4<?>> blockingQueue) {
        this.d = r4Var;
        Objects.requireNonNull(blockingQueue, "null reference");
        this.a = new Object();
        this.b = blockingQueue;
        setName(str);
    }

    public final void a(InterruptedException interruptedException) {
        this.d.d().i.b(String.valueOf(getName()).concat(" was interrupted"), interruptedException);
    }

    public final void b() {
        synchronized (this.d.i) {
            if (!this.c) {
                this.d.j.release();
                this.d.i.notifyAll();
                r4 r4Var = this.d;
                if (this == r4Var.c) {
                    r4Var.c = null;
                } else if (this == r4Var.d) {
                    r4Var.d = null;
                } else {
                    r4Var.d().f.a("Current scheduler thread is neither worker nor network");
                }
                this.c = true;
            }
        }
    }

    /* JADX WARNING: Missing block: B:38:0x006e, code skipped:
            b();
     */
    /* JADX WARNING: Missing block: B:39:0x0071, code skipped:
            return;
     */
    public final void run() {
        /*
        r5 = this;
        r0 = 0;
    L_0x0001:
        if (r0 != 0) goto L_0x0011;
    L_0x0003:
        r1 = r5.d;	 Catch:{ InterruptedException -> 0x000c }
        r1 = r1.j;	 Catch:{ InterruptedException -> 0x000c }
        r1.acquire();	 Catch:{ InterruptedException -> 0x000c }
        r0 = 1;
        goto L_0x0001;
    L_0x000c:
        r1 = move-exception;
        r5.a(r1);
        goto L_0x0001;
    L_0x0011:
        r0 = android.os.Process.myTid();	 Catch:{ all -> 0x007a }
        r0 = android.os.Process.getThreadPriority(r0);	 Catch:{ all -> 0x007a }
    L_0x0019:
        r1 = r5.b;	 Catch:{ all -> 0x007a }
        r1 = r1.poll();	 Catch:{ all -> 0x007a }
        r1 = (c.e.a.b.f.b.s4) r1;	 Catch:{ all -> 0x007a }
        if (r1 == 0) goto L_0x0032;
    L_0x0023:
        r2 = r1.b;	 Catch:{ all -> 0x007a }
        if (r2 == 0) goto L_0x0029;
    L_0x0027:
        r2 = r0;
        goto L_0x002b;
    L_0x0029:
        r2 = 10;
    L_0x002b:
        android.os.Process.setThreadPriority(r2);	 Catch:{ all -> 0x007a }
        r1.run();	 Catch:{ all -> 0x007a }
        goto L_0x0019;
    L_0x0032:
        r1 = r5.a;	 Catch:{ all -> 0x007a }
        monitor-enter(r1);	 Catch:{ all -> 0x007a }
        r2 = r5.b;	 Catch:{ all -> 0x0077 }
        r2 = r2.peek();	 Catch:{ all -> 0x0077 }
        if (r2 != 0) goto L_0x004e;
    L_0x003d:
        r2 = r5.d;	 Catch:{ all -> 0x0077 }
        java.util.Objects.requireNonNull(r2);	 Catch:{ all -> 0x0077 }
        r2 = r5.a;	 Catch:{ InterruptedException -> 0x004a }
        r3 = 30000; // 0x7530 float:4.2039E-41 double:1.4822E-319;
        r2.wait(r3);	 Catch:{ InterruptedException -> 0x004a }
        goto L_0x004e;
    L_0x004a:
        r2 = move-exception;
        r5.a(r2);	 Catch:{ all -> 0x0077 }
    L_0x004e:
        monitor-exit(r1);	 Catch:{ all -> 0x0077 }
        r1 = r5.d;	 Catch:{ all -> 0x007a }
        r1 = r1.i;	 Catch:{ all -> 0x007a }
        monitor-enter(r1);	 Catch:{ all -> 0x007a }
        r2 = r5.b;	 Catch:{ all -> 0x0074 }
        r2 = r2.peek();	 Catch:{ all -> 0x0074 }
        if (r2 != 0) goto L_0x0072;
    L_0x005c:
        r0 = r5.d;	 Catch:{ all -> 0x0074 }
        r0 = r0.a;	 Catch:{ all -> 0x0074 }
        r0 = r0.g;	 Catch:{ all -> 0x0074 }
        r2 = c.e.a.b.f.b.p.r0;	 Catch:{ all -> 0x0074 }
        r0 = r0.o(r2);	 Catch:{ all -> 0x0074 }
        if (r0 == 0) goto L_0x006d;
    L_0x006a:
        r5.b();	 Catch:{ all -> 0x0074 }
    L_0x006d:
        monitor-exit(r1);	 Catch:{ all -> 0x0074 }
        r5.b();
        return;
    L_0x0072:
        monitor-exit(r1);	 Catch:{ all -> 0x0074 }
        goto L_0x0019;
    L_0x0074:
        r0 = move-exception;
        monitor-exit(r1);	 Catch:{ all -> 0x0074 }
        throw r0;	 Catch:{ all -> 0x007a }
    L_0x0077:
        r0 = move-exception;
        monitor-exit(r1);	 Catch:{ all -> 0x0077 }
        throw r0;	 Catch:{ all -> 0x007a }
    L_0x007a:
        r0 = move-exception;
        r5.b();
        throw r0;
        */
        throw new UnsupportedOperationException("Method not decompiled: c.e.a.b.f.b.v4.run():void");
    }
}
